{include file='common/head'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>管理员列表</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加管理员','{:url(\'index/guanli/guanliadd\')}')"><i class="layui-icon"></i>添加管理员</button>
        <span class="x-right" style="line-height:40px">共有数据：<?php echo $tiao?> 条</span>
    </xblock>
    <table class="layui-table" >
        <thead >
        <tr>   
            <th>NO</th>
            <th style="text-align:center">用户ID</th>
            <th>头像</th>
            <th>手机号码</th>
            <th>姓名</th><!--显示12个字-->
            <th>角色</th>
            <th style="text-align:center">操作</th>
        </tr>
        </thead>
        <tbody>
		{volist name="data" id="val"}
        <tr>
            <td>{$i}</td>
            <td>{$val.id}</td>
            <td><img src="/upload/head/{$val.head_portrait}" width="80"></td>
            <td>{$val.phone}</td>
            <td>{$val.gname}</td>
            <td>{$val.jname}</td>
            <td class="td-manage">
                <a title="删除" onclick="member_del(this,'{$val.id}')"  href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>删除
                </a>
                <a title="修改" onclick="banner_edit(this)" attr_id='{$val.id}' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>修改
                </a>
            </td>
        </tr>
		{/volist}
        </tbody>
    </table>
    <div class="page">
        <div>
           {$page}
        </div>
    </div>

</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

   
    /*管理员-删除*/
    function member_del(obj,id){
        layer.confirm('您确认要删除吗？',function(index){
            //发异步删除数据
			$.ajax({
				url:"{:URL('guanli/delete')}",
				data:{"id":id},
				type:"post",
				dataType:'json',
				success:function(msg){
					if(msg.code==1){
						$(obj).parents("tr").remove();
						layer.msg(msg.msg,{icon:1,time:1000});
					}else{
						layer.msg(msg.msg,{icon:1,time:1000});
					}
				}
			})
             
        });
    }

	/*管理员-修改*/
	function banner_edit(obj){

				
				var mid=$(obj).attr('attr_id');
				//alert(mid);
				var url="{:URL('guanli/update')}?id="+mid;
				//alert(url);
				x_admin_show('修改用户',url);
		}

</script>

</body>

</html>